import { defineStore } from 'pinia'
// 创建store,命名规则： useXxxxStore
// 参数1：store的唯一表示
// 参数2：对象，可以提供state actions getters
const menuStore = defineStore('menu', {
  state: (): any => {
    return {
      collapsed: false,
      openKeys: [],
      selectedKeys: ['home'],
      routeTabs: [{ title: '首页', path: '/home', key: 'home' }],
      activeKey: 'home',
      keepRoutes: [],
      routes: ['layout', 'home','setRoute']
    }
  },
  persist: true,
  actions: {
    restoreOriginalData() {
      this.collapsed = false
      this.openKeys = []
      this.selectedKeys = ['home']
      this.activeKey = 'home'
      this.routeTabs.splice(1, this.routeTabs.length)
    },
  },
  getters: {},
})

export default menuStore
